Repository navigation
[GLB-239] fix(profile): 새 탭으로 바로 연 약관·프로필·탈퇴 화면도 뒤로가기 시 기본 경로로 이동 - #374
Merged
Merged
Conversation
- 새 탭은 빈 페이지 기록이 있어 history.length가 2라 앱 밖 기록으로 back이 실행됐음 - 앱 안 화면 이동을 sessionStorage에 기록하고 그 기록이 있을 때만 뒤로 가게 바꿈
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#️⃣연관된 이슈
📝작업 내용
문제
window.history.length > 1이면 뒤로 가게 했습니다./terms를 바로 열면history.length가 2였습니다(빈 페이지 기록 1개 + 약관 1개). 그래서router.back()이 실행돼 뒤로가기를 눌러도 이동하지 않았습니다. 티켓의 재현 방법("새 탭에서 열고 뒤로가기")이 이 경우입니다.수정
apps/web/src/components/common/InAppNavigationTracker.tsx를 추가하고ClientLayout에 넣었습니다. 처음 들어온 화면에서 다른 화면으로 이동하면sessionStorage에 앱 안 이동 기록을 남깁니다.goBackOrFallback은 이제history.length대신 이 기록을 봅니다. 기록이 있으면router.back(), 없으면 기본 경로로 갑니다.sessionStorage가 비어 있어서, 바로 연 화면은 기본 경로로 갑니다.sessionStorage를 쓸 수 없는 환경에서는 기록이 없는 것으로 보고 기본 경로로 갑니다.ErrorPageContent의 뒤로가기도history.length > 1을 쓰지만, 이 티켓 범위가 아니라 건드리지 않았습니다.확인
navigation.test.ts3개 통과history.length가 2여도 기록이 없으면 기본 경로로 감turbo run build typecheck lint:check test: 통과/terms를 바로 열고 뒤로가기:history.length2, 기록 없음 →/로 이동 → 비로그인이라/login/login→ 약관 링크로/terms→ 뒤로가기 →/login(이전 화면)으로 돌아옴@coderabbitai ignore
🤖 Generated with Claude Code